<%@ page contentType="text/html;charset=utf-8"%>
<!--
	网页编码好像是个很麻烦的问题之后再研究
 -->

 <html>
 <head>
 	<title>处理汉字信息</title>
 </head>
 <body background="cyan"><font size="3">
 	
 <form action="" name="form" method="post">
 	<input type="text" name="info" size="50"></input>
 	<input type="submit" value="确定" name="submit"></input>
 	
 </form>

 <%
 	request.setCharacterEncoding("utf-8");
 	String content = request.getParameter("info");
 	double sum = 0;
 	if(content == null){
 		content = "0";
 	}
 %>
 	<hr> <b>账单内容：<br><%= content %></b>
 <%
 	String[] info = content.split("[^0123456789.]");
 	for (String a : info) {
 		try{
 			sum += Double.parseDouble(a);
 		} catch(NumberFormatException exp){
 		} 
 	}
 	out.println("<hr>账单消费总额："+ sum);
 	// try{
 	// 	for(String a : info){
 	// 		out.println(a);
 	// 		sum += Double.parseDouble(a);
 	// 	}
 	// } catch(NumberFormatException exp){
 	// 	out.println("输入有误");
 	// } 
 %>
 </font> </body>
 </html>